package game;

/*
 * player class, contains all player data
 */
public class Player {

	/*
	 *  card%13=figure (Ace,2,3,4,5,6,7,8,9,10,Jack,Queen,King)
	 *  card%4=color (clubs,diamonds,hearts,spades)
	 */
	public int[] cards;
	public boolean isinplay;
	public boolean allin;
	/*
	 * bot=0 human
	 * bot=1 ai1
	 * ...
	 */
	public int bot;
	public int bet;

	public Player()
	{
			cards=new int[4];
			bet=0;
			for (int i=0;i<4;i++) {
				cards[i]=52;
			}
			isinplay=true;
			allin=false;
			bot=0;
	}
	
	public void setbot(int i) {
		bot=i;
		}
	
	public int[] CheckCards() {
		int[] best=new int[2];
		best[0]=0;
		best[1]=13;
		for (int i=1;i<16;i++) {
			int numberofcards=0,highestcard=0;
			int [] cards=new int[4];
			cards[numberofcards]=this.cards[0];
			if(i%2==1) numberofcards++;
			cards[numberofcards]=this.cards[1];
			if((i/2)%2==1) numberofcards++;
			cards[numberofcards]=this.cards[2];
			if((i/4)%2==1) numberofcards++;
			cards[numberofcards]=this.cards[3];
			if((i/8)%2==1) numberofcards++;
			boolean different=true;
			for (int j=0;j<numberofcards;j++){
				for (int k=j+1;k<numberofcards;k++) {
					if (cards[j]%13==cards[k]%13 || cards[j]%4==cards[k]%4) different=false;
				}
				if (cards[j]>highestcard) highestcard=cards[j];
			}
			if (different && (numberofcards>best[0] || (numberofcards==best[0] && highestcard<best[1]))) {
				best[0]=numberofcards;
				best[1]=highestcard;
			}
		}
		return best;
	}
}
